# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=msitools
pkgver=0.100
pkgrel=0
pkgdesc="Set of programs to inspect and build Windows Installer (.MSI) files"
url="https://wiki.gnome.org/msitools"
arch="all"
license="GPL-2.0-or-later LGPL-2.1-or-later"
makedepends="libgsf-dev libgcab-dev vala intltool libtool bison"
subpackages="$pkgname-dev $pkgname-lang
	$pkgname-bash-completion:bashcomp:noarch"
source="https://download.gnome.org/sources/msitools/$pkgver/msitools-$pkgver.tar.xz
	fix-segfault.patch"
[ "$CARCH" = "s390x" ] && options="!check" # multiple test failures

build() {
	./configure --prefix=/usr --disable-static
	sed -i 's|LIBTOOL = $(SHELL) $(top_builddir)/libtool|LIBTOOL = /usr/bin/libtool|g' Makefile
	make
}

check() {
	make check
}

package() {
	make install DESTDIR="$pkgdir"
}

bashcomp() {
	depends=""
	pkgdesc="Bash completion for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	mkdir -p "$subpkgdir"/usr/share/bash-completion/completions/
	mv "$pkgdir"/usr/share/bash-completion/completions/* \
		"$subpkgdir"/usr/share/bash-completion/completions/
}

sha512sums="a903a84aadb01a5b0d6591250466dabecfbf423588c5c47996d8cfb43770d5a1c4f7f8ad536cfc4659aa66326526be158495879d0dfd3f48c33eb8c3e4c2dfc2  msitools-0.100.tar.xz
71311d61517997ac7017611326e81e2ec1d5ebdd87179096973299c04f89d2207a046e2437d6e310ee17325d7f527790519e98672f9256ba0574fc8f3a4e87ce  fix-segfault.patch"
